// ==========================================================================
// gin-sns auto gen code.
// date：2021-02-21 13:45:54 +0800 CST
// path: app/model/module/question/question_entity.go
// author：jon
// ==========================================================================

package question

import (
	"time"
)

// 数据表映射结构体
type Entity struct {
	Id          int64     `json:"id" xorm:"not null pk autoincr comment('id') bigint(20) unsigned"`
	UserId      int64     `json:"user_id" xorm:"comment('发布者') bigint(20)"`
	Title       string    `json:"title" xorm:"comment('标题') varchar(255)"`
	Content     string    `json:"content" xorm:"comment('内容') text"`
	Score       int       `json:"score" xorm:"comment('最佳答案奖励积分数量') int(11)"`
	Weight      int64     `json:"weight" xorm:"comment('问题权重') double(11,0)"`
	CountAnswer int64     `json:"count_answer" xorm:"comment('答案数量') bigint(20)"`
	CountFollow int64     `json:"count_follow" xorm:"comment('关注该问题数量') bigint(20)"`
	Status      int       `json:"status" xorm:"comment('0未审核 1正常状态 2审核未通过 3删除') tinyint(2)"`
	CreateTime  time.Time `json:"create_time" xorm:"comment('创建时间') datetime"`
	UpdateTime  time.Time `json:"update_time" xorm:"comment('最后更新时间') datetime"`
}

//新增页面请求参数
type AddReq struct {
	UserId      int64  `form:"userId" `
	Title       string `form:"title" `
	Content     string `form:"content" `
	Score       int    `form:"score" `
	Weight      int64  `form:"weight" `
	CountAnswer int64  `form:"countAnswer" `
	CountFollow int64  `form:"countFollow" `
	Status      int    `form:"status" binding:"required"`
}

//修改页面请求参数
type EditReq struct {
	Id          int64  `form:"id" binding:"required"`
	UserId      int64  `form:"userId" `
	Title       string `form:"title" `
	Content     string `form:"content" `
	Score       int    `form:"score" `
	Weight      int64  `form:"weight" `
	CountAnswer int64  `form:"countAnswer" `
	CountFollow int64  `form:"countFollow" `
	Status      int    `form:"status" binding:"required不能为空"`
}

//分页请求参数
type SelectPageReq struct {
	UserId      int64  `form:"userId"`      //发布者
	Title       string `form:"title"`       //标题
	Content     string `form:"content"`     //内容
	Score       int    `form:"score"`       //最佳答案奖励积分数量
	Weight      int64  `form:"weight"`      //问题权重
	CountAnswer int64  `form:"countAnswer"` //答案数量
	CountFollow int64  `form:"countFollow"` //关注该问题数量
	Status      int    `form:"status"`      //0未审核 1正常状态 2审核未通过 3删除
	BeginTime   string `form:"beginTime"`   //开始时间
	EndTime     string `form:"endTime"`     //结束时间
	PageNum     int    `form:"pageNum"`     //当前页码
	PageSize    int    `form:"pageSize"`    //每页数
}
